#include <QApplication>
#include <QCommandLineParser>
#include "mainprocess.h"
#include "tianqiconfig.h"
#include <iostream>

int main(int argc, char *argv[]) {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
    QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
    QApplication app(argc, argv);
    QApplication::setOrganizationName("Fansionia");
    // QApplication::setOrganizationDomain("hamletfansion.top");
    QApplication::setApplicationName("Tianqi");
    QApplication::setApplicationVersion(TIANQI_VERSION);

    QCommandLineParser parser;
    parser.setApplicationDescription(QApplication::tr("一个桌面天气小工具。"));
    parser.addHelpOption();
    parser.addVersionOption();

    parser.process(app);

    if (!QSystemTrayIcon::isSystemTrayAvailable()) {
        std::cerr << "Cannot detect any system tray on this system.";
        return 1;
    }
    QApplication::setQuitOnLastWindowClosed(false);

    MainProcess process;
    return QApplication::exec();
}
